﻿/*
 *	Copyright (c) 2009 Queensland University of Technology. All rights reserved.
 *	The QUT Bioinformatics Collection is open source software released under the 
 *	Microsoft Public License (Ms-PL): http://www.microsoft.com/opensource/licenses.mspx.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QUT.Bio.Util {

	/// <summary>
	///		An interface that allows us to implement something that resembles indexed 
	///		properties mapping 0 .. (N-1) -> T.
	/// </summary>
	/// <typeparam name="T">The type of value indexed by the indexer.</typeparam>

	public interface Indexer<T> : IEnumerable<T> {
	
		/// <summary>
		///		Gets the number of elements indexed by the indexer.
		/// </summary>
		
		int Count {
			get;
		}

		/// <summary>
		///		Gets the value associated with a specified index position.
		/// </summary>
		/// <param name="i">
		///		The position, which should lie in the range 0 .. (Count-1)
		///	</param>
		/// <returns>
		///		The value at position i.
		/// </returns>

		T this[int i] {
			get;
			set;
		}
	}

	public interface Indexer<IndexType, OutputType>: IEnumerable<OutputType> {
		OutputType this[IndexType i] {
			get;
			set;
		}
	}

	public interface ReadonlyIndexer<T> : IEnumerable<T> {
		int Count {
			get;
		}

		T this[int i] {
			get;
		}
	}

	public interface ReadonlyIndexer<IndexType, OutputType>: IEnumerable<OutputType> {
		OutputType this[IndexType i] {
			get;
		}
	}
}
